home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / unprobas.zip / UNPROBAS.DOC < prev   
Text File  |  1985-05-26  |  4KB  |  78 lines

  1.         UnProtecting Basic Programs
  2.                     v 0.1 of Tue May 21 85
  3.  
  4. Unprotecting BASICA (or GW Basic) files is a fairly simple task, if
  5. you have the right tools and know what to look for.  The following
  6. sequence is the procedure for creating a copy of BASICA, version 2.0,
  7. that will NOT test the protect flag when you ask for a LIST, LLIST,
  8. SAVE, etc.  Here I use Microsoft's SYMDEB version 3 (part of version
  9. 3 MASM-86) but the same can be done with DEBUG.  This procedure is
  10. possible as the BasicA LOAD or implied (command line) program load both
  11. convert the program to BasicA's normal tokenized internal format and
  12. just relies on an internal flag to disallow those commands.  This patch
  13. changes that flag test to always return "allowed".  The comments below
  14. following the "*" character have been added as an explanation.
  15.  
  16. In the following we patch the main version of BASICA (in this version, three
  17. programs make up the BASIC set, they are named BASIC.COM, BASICA.COM
  18. and BASICA.EXE.  The first two are just loaders for the latter, which
  19. we'll patch).
  20.  
  21. Note, finally, that the search pattern I used is for the OR AL,AL
  22. JMP +2  POPF  RET and JMP opcodes, which makes the search version inde-
  23. pendent (where the exact addresses may vary).
  24.  
  25. D> copy basica.exe b.xxx        * Make a writable copy to patch
  26.     1 File(s) copied        *  (DEBUG won't write .EXE files).
  27.  
  28.  
  29. D> SymDeb b.xxx                * Invoke SYMDEB, or use DEBUG B.XXX
  30.  
  31. Microsoft Symbolic Debug Utility
  32. Version 3.00
  33. (C)Copyright Microsoft Corp 1984
  34. Processor is [8086]
  35. -s cs:0 l ffff 0a c0 75 02 9d c3 e9    * Search for the test, NO addresses.
  36. 786B:A557                * SYMDEB only found the right address.
  37. -u cs:a554                * UNASSEMBLE 3 bytes BEFORE that.
  38. 786B:A554 A00C06         MOV    AL,[060C] 
  39. 786B:A557 0AC0           OR     AL,AL 
  40. 786B:A559 7502           JNZ    A55D 
  41. 786B:A55B 9D             POPF    
  42. 786B:A55C C3             RET     
  43. 786B:A55D E95068         JMP    0DB0 
  44. 786B:A560 807C2800       CMP    Byte Ptr [SI+28],00 
  45. 786B:A564 7403           JZ     A569 
  46.                     * NOTE in the above that the address
  47.                     *  of the first instruction may vary
  48.                     *  slightly with the BASICA version.
  49. -a cs:a554                * ASSEMBLE the following patch:
  50. 786B:A554 mov al,0            *   Put a zero into AL,
  51. 786B:A556 nop                *   NOP for the correct code length.
  52. 786B:A557                 * RETURN only to stop ASSEMBLE.
  53. -u cs:a554                * UNASSEMBLE the code to check it.
  54. 786B:A554 B000           MOV    AL,00 
  55. 786B:A556 90             NOP     
  56. 786B:A557 0AC0           OR     AL,AL 
  57. 786B:A559 7502           JNZ    A55D 
  58. 786B:A55B 9D             POPF    
  59. 786B:A55C C3             RET     
  60. 786B:A55D E95068         JMP    0DB0 
  61. 786B:A560 807C2800       CMP    Byte Ptr [SI+28],00 
  62. -w                    * Looks good, WRITE it to disk,
  63. Writing FF90 bytes            * this may vary slightly on yours,
  64. -q                    * and QUIT the SYMDEBugger.
  65.  
  66. D> Ren b.xxx b-unprot.exe        * REName the file to use it.
  67.  
  68. D>
  69. That does it.  You now have a program named B-UnProt that will allow you
  70. to load a protected file, LIST, SAVE, edit, etc, it to your heart's content.
  71. If anyone is interested in the technique used to determine this patch, let
  72. me know and I'll detail it.  In short, SYMDEB made it easier, but the same
  73. "tricks" can be done even with a primitive debugger, such as DEBUG.
  74.  
  75. Also, if your version does NOT give you an address, let me know and I'll
  76. attempt to provide additional information.  Forward any comments to me.
  77.                 Enjoy.        Len C... [72115,214]
  78.